#ifndef __TEST_CASE_H
#define __TEST_CASE_H

#include <Ishtar/Ishtar.h>
#pragma once

#include <Ishtar/Async/WaitableBool.h>
#include <Ishtar/Chrono/TickClock.h>
#include <Ishtar/Storage/IniFileView.h>
#include <Ishtar/Task/WorkExecutor.h>
#include <Ishtar/Task/WorkerThread.h>
#include <Ishtar/Thread/ThreadGroup.h>

using namespace std;
using namespace Ishtar;


class TestCase
{
public:

    TestCase();

    virtual string GetName() const = 0;

    Bool IsStopped() const { return m_stopped; }

    void Run();
    void Stop();

protected:

    boost::scoped_ptr< Task::WorkExecutor > m_executor;
    ThreadGroup m_threads;

    const IniSection* GetBuildSection() const;

    IniFileView m_iniFile;

private:

    virtual void DoRun()  = 0;

    WaitableBool m_stopped;
};


//
// Case 1
// - Commit works by 1 or more threads.
//   See how long it costs.
//

class CommitRateTest : public TestCase
{
private:
    void DoRun();
    void Execute( Uint numWorks );
    void Perform();

    string GetName() const { return "CommitRate"; }
};


#endif // __TEST_CASE_H
